package com.xsherl.leetcode.solution;

public class PalindromeNumber {

    /**
     * 翻转数字，然后和原数字比较
     */
    public boolean isPalindrome(int x) {
        int n = x;
        int y = 0;
        while (n > 0){
            y = y * 10 + (n % 10);
            n /= 10;
        }
        return y == x;
    }

    public static void main(String[] args) {
        int x = 565;
        System.out.println(new PalindromeNumber().isPalindrome(x));
    }
}
